﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PC_UnDivideWait.aspx.cs" Inherits="PMS.WaitDealUI.PC_UnDivideWait" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var DealId = com.get.DealId;
            $("#tbList").datagrid({
                url: '/Logic/CommonAjax/WaitDealAjax.aspx?method=CommonWaitDealList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: true,
                rownumbers: true,
                idField: "ID",
                singleSelect: false,
                queryParams: { DealId: DealId },
                striped: true,
                frozenColumns: [[{ field: 'ck', checkbox: true, width: 30 },
                 { field: 'ID', title: 'ID ', align: "center" },
                 //{ field: 'DemandPlanId', title: '计划主表ID ', align: "center" },
                // { field: 'DemandPlanInfoId', title: '计划分表ID ', align: "center" },
                 { field: 'PlanTrackId', title: '计划跟踪号 ', align: "center" },
                 { field: 'Tuhao', title: '图号/标识号 ', align: "center" },
                 { field: 'MaterialCode', title: '物料编码 ', align: "center" },
                 { field: 'MaterialName', title: '物料名称 ', align: "center" }, ]],
                columns: [[
                 { field: 'MaterialGuige', title: '规格 ', align: "center" },
                 { field: 'MaterialCaizhi', title: '材质 ', align: "center" },
                 { field: 'MaterialGB', title: '国标 ', align: "center" },
                 { field: 'MaterialType', title: '材料类型 ', align: "center" },
                 { field: 'MaterialLength', title: '长 ', align: "center" },
                 { field: 'MaterialWidth', title: '宽 ', align: "center" },
                 { field: 'PcPlanNum', title: '采购数量 ', align: "center", },
                 { field: 'PurchaseUnit', title: '单位', align: "center" },
                 { field: 'PcPlanAidNum', title: '采购辅助数量 ', align: "center", },
                 { field: 'PurchaseAidUnit', title: '辅助单位', align: "center" },
                 { field: 'PurchaseName', title: '采购员 ', align: "center" },
                 {
                     field: 'State', title: '总状态 ', align: "center", formatter: function (value, row, Index) {
                         return com.getArrayText(StaticCombo.PcDemandPlanState, value);
                     }
                 },
                 {
                     field: 'ReplaceState', title: '代用状态 ', align: "center", formatter: function (value, row, Index) {
                         return com.getArrayText(StaticCombo.replaceState, value);
                     }
                 },
               { field: 'Note', title: '备注 ', align: "center" }, ]]
            });
        });
        //分工
        function funcDivide() {

            rows = $("#tbList").datagrid("getSelections");
            if (rows) {
                $("#pickPerDiv").dialog("open");
            }
            else {
                com.message("information", "请至少选中一行");

            }
        }
    </script>
    <script type="text/javascript">

        $(function () {

            $("#tbPicPer").datagrid({
                url: '/Logic/BD/UserAjax.aspx?method=GetUserList',
                loadMsg: '数据加载中请稍后……',
                pagination: true,
                rownumbers: true,
                idField: "ID",
                fitColumns: true,
                columns: [[
                    {
                        field: 'ck', checkbox: true, width: 30
                    },

                            {
                                field: 'UserName', title: '姓名', sortable: true, width: 100, align: "center"
                            }, {
                                field: 'DepName', title: '部门', sortable: true, width: 100, align: "center"
                            },
                                 {
                                     field: 'PosName', title: '岗位', sortable: true, width: 80, align: "center"
                                 }


                ]],
                singleSelect: true,
                pageSize: 8,
                pageList: [8, 20, 50, 100],
                striped: true
            });
            $("#perCombo").combobox({
                url: '/logic/CommonAjax/UserRelateAjax.aspx?method=GetDep',
                valueField: 'value',
                textField: 'text',
                width: 150,
                panelHeight: "auto",
                onChange: picPer.ReloadGrid
            });
            $("#textSearchPer").change(function () {
                picPer.ReloadGrid();
            });
            $.extend(com.dialogObj, { title: "选择人员", width: 470, height: 375 });
            $("#pickPerDiv").dialog(
                    com.dialogObj
                 );
            $("#pickPerDiv").dialog("close");
        });
        function thisConfirm() {
            var rowPer = $("#tbPicPer").datagrid("getSelected");
            if (rowPer) {
                var Id = "";
                Id += rowPer.ID + "," + rowPer.UserName + ",";
                for (var i = 0; i < rows.length; i++) {
                    Id += rows.ID + ",";
                }
                var o = { userId: JSON.stringify(rowPer), planInfo: JSON.stringify(rows) };
                com.ajax({
                    url: "/Logic/PC/PC_DemandPlanAjax.aspx?method=AssignDemondPlan", data: o, success: function (data) {
                        com.message("success", data.msg, function () {
                            $("#pickPerDiv").dialog("close");
                            $("#tbList").datagrid("reload");
                            $("#tbList").datagrid("unselectAll");
                        })
                    }
                });
            }
            else {
                com.message("information", "请选择一条数据");
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="divide" class="easyui-linkbutton" onclick="funcDivide()"
        data-options="iconCls:'icon-arrow_divide',plain:true">分工</a> &nbsp;&nbsp;
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <table id="tbList" title="需用计划表--待分工" style="width: 100%; height: 360px">
    </table>
     <div id='pickPerDiv'>
        <div id="picPerHead" style="height: 28px; width: 450px;">
            &nbsp;&nbsp;选择部门：<input id="perCombo" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名：
            <input id='textSearchPer' type='text' />
        </div>
        <table id='tbPicPer' style='height: 273px; width: 450px; overflow: scroll'></table>
        <div class="dialog-bottom">&nbsp;<a href='#' class='easyui-linkbutton' data-options="iconCls:'icon-ok'" onclick="thisConfirm()">确定</a>&nbsp;&nbsp;&nbsp;<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="picPer.Cancel()">取消</a></div>
    </div>
</asp:Content>
